package com.guslegend.spzx.service.spzx.util;

import com.guslegend.spzx.model.entity.system.SysUser;

/**
 * @author: guslegend
 * @description: 对ThreadLocal进行封装
 * @create: 2025-05-06 08:37
 **/
public class AuthContextUtil {

    // 创建一个ThreadLocal对象
    private static final ThreadLocal<SysUser> threadLocal = new ThreadLocal<>() ;

    // 定义存储数据的静态方法
    public static void set(SysUser sysUser) {
        threadLocal.set(sysUser);
    }

    // 定义获取数据的方法
    public static SysUser get() {
        return threadLocal.get() ;
    }

    // 删除数据的方法
    public static void remove() {
        threadLocal.remove();
    }

}